{% extends "base.html" %}

{% block title %}{{ topic.title }} - 讨论区 - 校园生活助手{% endblock %}

{% block css %}
<style>
    .topic-detail-container {
        max-width: 1000px;
        margin: 0 auto;
    }
    .topic-header {
        background-color: white;
        border-radius: 0.5rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        padding: 2rem;
        margin-bottom: 2rem;
    }
    .topic-title {
        font-size: 1.75rem;
        font-weight: 700;
        color: #495057;
        margin-bottom: 1rem;
        line-height: 1.3;
    }
    .topic-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 1.5rem;
        margin-bottom: 1.5rem;
        font-size: 0.875rem;
        color: #6c757d;
    }
    .topic-author {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    .topic-author-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        object-fit: cover;
    }
    .topic-author-info {
        display: flex;
        flex-direction: column;
    }
    .topic-author-name {
        font-weight: 600;
        color: #495057;
        margin-bottom: 0.25rem;
    }
    .topic-time-info {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }
    .topic-stats {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    .topic-views {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }
    .topic-replies {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }
    .topic-labels {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }
    .topic-label {
        padding: 0.3rem 0.8rem;
        border-radius: 1rem;
        font-size: 0.75rem;
        font-weight: 500;
        text-decoration: none;
        transition: all 0.2s;
    }
    .topic-label.primary {
        background-color: #e3f2fd;
        color: #1976d2;
    }
    .topic-label.primary:hover {
        background-color: #bbdefb;
    }
    .topic-label.success {
        background-color: #e8f5e9;
        color: #388e3c;
    }
    .topic-label.success:hover {
        background-color: #c8e6c9;
    }
    .topic-label.warning {
        background-color: #fff3e0;
        color: #f57c00;
    }
    .topic-label.warning:hover {
        background-color: #ffe0b2;
    }
    .topic-label.danger {
        background-color: #ffebee;
        color: #d32f2f;
    }
    .topic-label.danger:hover {
        background-color: #ffcdd2;
    }
    .topic-content {
        background-color: white;
        border-radius: 0.5rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        padding: 2rem;
        margin-bottom: 2rem;
        line-height: 1.6;
        color: #495057;
    }
    .topic-actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: white;
        border-radius: 0.5rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        padding: 1rem 2rem;
        margin-bottom: 2rem;
    }
    .topic-main-actions {
        display: flex;
        gap: 1rem;
    }
    .action-btn {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        background-color: white;
        color: #495057;
        cursor: pointer;
        transition: all 0.2s;
    }
    .action-btn:hover {
        background-color: #f8f9fa;
        border-color: #adb5bd;
    }
    .action-btn.liked {
        background-color: #fff3cd;
        border-color: #ffeaa7;
        color: #856404;
    }
    .action-btn.bookmarked {
        background-color: #d1ecf1;
        border-color: #bee5eb;
        color: #0c5460;
    }
    .comment-section {
        background-color: white;
        border-radius: 0.5rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        padding: 2rem;
        margin-bottom: 2rem;
    }
    .comment-section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.5rem;
    }
    .comment-section-title {
        font-size: 1.25rem;
        font-weight: 600;
        color: #495057;
    }
    .comment-form {
        margin-bottom: 2rem;
    }
    .comment-input-container {
        display: flex;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    .comment-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        object-fit: cover;
        flex-shrink: 0;
    }
    .comment-input-wrapper {
        flex: 1;
    }
    .comment-textarea {
        width: 100%;
        min-height: 120px;
        padding: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        resize: vertical;
        font-family: inherit;
        font-size: 1rem;
        line-height: 1.5;
    }
    .comment-textarea:focus {
        outline: none;
        border-color: #007bff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }
    .comment-actions {
        display: flex;
        justify-content: flex-end;
        gap: 1rem;
        margin-top: 1rem;
    }
    .comments-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .comment-item {
        padding: 1.5rem 0;
        border-bottom: 1px solid #e9ecef;
    }
    .comment-item:last-child {
        border-bottom: none;
    }
    .comment-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 1rem;
    }
    .comment-author-info {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    .comment-author-name {
        font-weight: 600;
        color: #495057;
        margin-bottom: 0.25rem;
    }
    .comment-time {
        font-size: 0.875rem;
        color: #6c757d;
    }
    .comment-content {
        margin-left: 56px;
        line-height: 1.6;
        color: #495057;
        margin-bottom: 1rem;
    }
    .comment-actions {
        display: flex;
        gap: 1.5rem;
        margin-left: 56px;
    }
    .comment-action-btn {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        padding: 0.25rem 0.75rem;
        border: none;
        background: none;
        color: #6c757d;
        cursor: pointer;
        border-radius: 0.25rem;
        transition: all 0.2s;
    }
    .comment-action-btn:hover {
        background-color: #f8f9fa;
        color: #495057;
    }
    .comment-action-btn.liked {
        color: #d32f2f;
    }
    .reply-form {
        margin-left: 56px;
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
    .reply-input-container {
        display: flex;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }
    .reply-textarea {
        width: 100%;
        min-height: 80px;
        padding: 0.75rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        resize: vertical;
        font-family: inherit;
        font-size: 0.875rem;
        line-height: 1.5;
    }
    .reply-textarea:focus {
        outline: none;
        border-color: #007bff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }
    .reply-actions {
        display: flex;
        justify-content: flex-end;
        gap: 0.75rem;
    }
    .replies-list {
        list-style: none;
        margin: 0;
        padding: 0;
        margin-left: 56px;
        margin-top: 1rem;
    }
    .reply-item {
        padding: 1rem 0;
        border-bottom: 1px solid #f1f3f5;
        display: flex;
        gap: 0.75rem;
    }
    .reply-item:last-child {
        border-bottom: none;
    }
    .reply-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        object-fit: cover;
        flex-shrink: 0;
    }
    .reply-content-wrapper {
        flex: 1;
    }
    .reply-header {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
    }
    .reply-author-name {
        font-weight: 600;
        color: #495057;
        font-size: 0.875rem;
    }
    .reply-time {
        font-size: 0.75rem;
        color: #6c757d;
    }
    .reply-content {
        line-height: 1.5;
        color: #495057;
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    .reply-actions {
        display: flex;
        gap: 1rem;
    }
    .reply-action-btn {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        padding: 0.25rem 0.5rem;
        border: none;
        background: none;
        color: #6c757d;
        cursor: pointer;
        border-radius: 0.25rem;
        transition: all 0.2s;
        font-size: 0.75rem;
    }
    .reply-action-btn:hover {
        background-color: #f8f9fa;
        color: #495057;
    }
    .related-topics {
        background-color: white;
        border-radius: 0.5rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        padding: 2rem;
        margin-bottom: 2rem;
    }
    .related-topics-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.5rem;
    }
    .related-topics-title {
        font-size: 1.25rem;
        font-weight: 600;
        color: #495057;
    }
    .related-topics-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .related-topic-item {
        padding: 1rem 0;
        border-bottom: 1px solid #e9ecef;
        transition: background-color 0.2s;
        cursor: pointer;
    }
    .related-topic-item:hover {
        background-color: #f8f9fa;
    }
    .related-topic-item:last-child {
        border-bottom: none;
    }
    .related-topic-title {
        font-size: 1.125rem;
        color: #495057;
        margin-bottom: 0.5rem;
        text-decoration: none;
        transition: color 0.2s;
    }
    .related-topic-title:hover {
        color: #007bff;
    }
    .related-topic-meta {
        display: flex;
        gap: 1rem;
        font-size: 0.875rem;
        color: #6c757d;
    }
    .related-topic-author {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }
    .related-topic-time {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }
    .related-topic-stats {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }
    .alert {
        padding: 1rem;
        border-radius: 0.25rem;
        margin-bottom: 1.5rem;
    }
    .alert-success {
        background-color: #d4edda;
        color: #155724;
        border: 1px solid #c3e6cb;
    }
    .alert-danger {
        background-color: #f8d7da;
        color: #721c24;
        border: 1px solid #f5c6cb;
    }
    .alert-warning {
        background-color: #fff3cd;
        color: #856404;
        border: 1px solid #ffeaa7;
    }
    .alert-info {
        background-color: #d1ecf1;
        color: #0c5460;
        border: 1px solid #bee5eb;
    }
    /* 响应式设计 */
    @media (max-width: 768px) {
        .topic-detail-container {
            padding: 0 1rem;
        }
        .topic-header {
            padding: 1.5rem 1rem;
        }
        .topic-title {
            font-size: 1.5rem;
        }
        .topic-meta {
            flex-direction: column;
            gap: 1rem;
        }
        .topic-content {
            padding: 1.5rem 1rem;
        }
        .topic-actions {
            flex-direction: column;
            gap: 1rem;
            padding: 1rem;
        }
        .topic-main-actions {
            width: 100%;
            justify-content: space-around;
        }
        .comment-section {
            padding: 1.5rem 1rem;
        }
        .comment-input-container {
            flex-direction: column;
        }
        .comment-content {
            margin-left: 0;
        }
        .comment-actions {
            margin-left: 0;
        }
        .reply-form {
            margin-left: 0;
        }
        .replies-list {
            margin-left: 0;
        }
        .reply-item {
            flex-direction: column;
        }
        .related-topics {
            padding: 1.5rem 1rem;
        }
        .related-topics-header {
            flex-direction: column;
            gap: 1rem;
            align-items: stretch;
        }
    }
</style>
{% endblock %}

{% block content %}
<div class="mb-6">
    <h1 class="text-2xl font-bold text-gray-800">
        <i class="fa fa-comments mr-2 text-primary"></i>讨论区
    </h1>
    <p class="text-gray-600">查看话题详情和参与讨论</p>
</div>

<!-- 消息提示区域 -->
{% with messages = get_flashed_messages(with_categories=true) %}
    {% if messages %}
        {% for category, message in messages %}
            <div class="alert alert-{{ category }} fade-in mb-4" role="alert">
                <button type="button" class="close" data-bs-dismiss="alert" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                {{ message }}
            </div>
        {% endfor %}
    {% endif %}
{% endwith %}

<div class="topic-detail-container">
    <!-- 话题头部 -->
    <div class="topic-header">
        <h1 class="topic-title">
            2024年计算机系考研经验分享
        </h1>
        <div class="topic-meta">
            <div class="topic-author">
                <img src="https://via.placeholder.com/48?text=学" alt="用户头像" class="topic-author-avatar">
                <div class="topic-author-info">
                    <div class="topic-author-name">学长2023</div>
                    <div class="topic-time-info">
                        <i class="fa fa-clock-o"></i>
                        发布于: 2024-05-15 14:30
                    </div>
                </div>
            </div>
            <div class="topic-stats">
                <div class="topic-views">
                    <i class="fa fa-eye"></i>
                    528 浏览
                </div>
                <div class="topic-replies">
                    <i class="fa fa-comment"></i>
                    32 回复
                </div>
            </div>
        </div>
        <div class="topic-labels">
            <a href="{{ url_for('forum', tag='考研') }}" class="topic-label primary">考研</a>
            <a href="{{ url_for('forum', tag='经验分享') }}" class="topic-label success">经验分享</a>
            <a href="{{ url_for('forum', tag='热门') }}" class="topic-label warning">热门</a>
        </div>
    </div>
    
    <!-- 话题内容 -->
    <div class="topic-content">
        <p>各位学弟学妹们好，我是2023级的计算机科学与技术专业的学长，今年成功考入了985高校的计算机学院。在这里，我想分享一下我的考研经验，希望能对大家有所帮助。</p>
        
        <h3 style="margin-top: 1.5rem; margin-bottom: 1rem;">一、考研准备阶段</h3>
        <p>考研准备阶段非常重要，我建议大家从大三下学期开始准备，这样有充足的时间来系统复习。</p>
        <ul style="margin-left: 1.5rem; margin-bottom: 1rem;">
            <li style="margin-bottom: 0.5rem;">制定合理的复习计划，分阶段进行</li>
            <li style="margin-bottom: 0.5rem;">选择适合自己的复习资料和辅导课程</li>
            <li style="margin-bottom: 0.5rem;">加入考研交流群，获取最新信息和经验</li>
        </ul>
        
        <h3 style="margin-top: 1.5rem; margin-bottom: 1rem;">二、公共课复习经验</h3>
        <p>政治和英语是考研的公共课，也是很多同学容易忽视的科目。</p>
        <p style="margin-bottom: 1rem;"><strong>政治复习</strong>：建议从暑假开始，使用肖秀荣的1000题和知识点精讲精练，考前重点背诵肖四肖八。</p>
        <p style="margin-bottom: 1rem;"><strong>英语复习</strong>：英语的复习是一个长期的过程，建议每天坚持背单词，做阅读理解，考前重点准备作文模板。</p>
        
        <h3 style="margin-top: 1.5rem; margin-bottom: 1rem;">三、专业课复习经验</h3>
        <p>计算机专业课通常包括数据结构、操作系统、计算机网络和计算机组成原理这四门课程。</p>
        <ul style="margin-left: 1.5rem; margin-bottom: 1rem;">
            <li style="margin-bottom: 0.5rem;">数据结构：重点掌握各种数据结构的基本概念、特点和应用场景，多做算法题</li>
            <li style="margin-bottom: 0.5rem;">操作系统：理解操作系统的基本概念和原理，重点掌握进程管理、内存管理、文件系统等内容</li>
            <li style="margin-bottom: 0.5rem;">计算机网络：掌握OSI七层模型和TCP/IP四层模型，重点理解各层的协议和功能</li>
            <li style="margin-bottom: 0.5rem;">计算机组成原理：理解计算机的基本组成和工作原理，重点掌握指令系统、CPU结构、存储器等内容</li>
        </ul>
        
        <h3 style="margin-top: 1.5rem; margin-bottom: 1rem;">四、复试准备</h3>
        <p>复试也是考研的重要组成部分，不要忽视。</p>
        <ul style="margin-left: 1.5rem; margin-bottom: 1rem;">
            <li style="margin-bottom: 0.5rem;">准备一份漂亮的简历，突出自己的优势</li>
            <li style="margin-bottom: 0.5rem;">复习专业课基础知识，准备常见的面试问题</li>
            <li style="margin-bottom: 0.5rem;">练习英语口语，准备英文自我介绍</li>
            <li style="margin-bottom: 0.5rem;">了解目标院校的研究方向，准备相关问题</li>
        </ul>
        
        <h3 style="margin-top: 1.5rem; margin-bottom: 1rem;">五、考研心得</h3>
        <p>考研是一个漫长而艰苦的过程，需要坚定的信念和毅力。</p>
        <ul style="margin-left: 1.5rem; margin-bottom: 1rem;">
            <li style="margin-bottom: 0.5rem;">保持良好的心态，不要给自己太大的压力</li>
            <li style="margin-bottom: 0.5rem;">合理安排时间，注意劳逸结合</li>
            <li style="margin-bottom: 0.5rem;">遇到问题及时解决，不要拖延</li>
            <li style="margin-bottom: 0.5rem;">相信自己，坚持到底就是胜利</li>
        </ul>
        
        <p style="margin-top: 1.5rem;">以上就是我的考研经验分享，希望能对大家有所帮助。如果有任何问题，欢迎在评论区留言，我会尽量回复大家。最后，祝大家考研顺利，金榜题名！</p>
    </div>
    
    <!-- 话题操作 -->
    <div class="topic-actions">
        <div class="topic-main-actions">
            <button id="like-btn" class="action-btn">
                <i class="fa fa-thumbs-up"></i>
                <span>点赞</span>
                <span>(45)</span>
            </button>
            <button id="bookmark-btn" class="action-btn">
                <i class="fa fa-bookmark"></i>
                <span>收藏</span>
            </button>
            <button id="share-btn" class="action-btn">
                <i class="fa fa-share-alt"></i>
                <span>分享</span>
            </button>
        </div>
        <div class="topic-other-actions">
            <button id="report-btn" class="action-btn">
                <i class="fa fa-flag"></i>
                <span>举报</span>
            </button>
        </div>
    </div>
    
    <!-- 评论区 -->
    <div class="comment-section">
        <div class="comment-section-header">
            <h3 class="comment-section-title">
                <i class="fa fa-comments-o mr-2"></i>
                评论 (32)
            </h3>
        </div>
        
        <!-- 评论表单 -->
        <div class="comment-form">
            <div class="comment-input-container">
                <img src="https://via.placeholder.com/48?text=当" alt="当前用户头像" class="comment-avatar">
                <div class="comment-input-wrapper">
                    <textarea id="comment-textarea" class="comment-textarea" placeholder="写下你的评论..."></textarea>
                    <div class="comment-actions">
                        <button id="cancel-comment-btn" class="btn btn-secondary">取消</button>
                        <button id="submit-comment-btn" class="btn btn-primary">发布评论</button>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 评论列表 -->
        <ul class="comments-list">
            <!-- 评论项1 -->
            <li class="comment-item">
                <div class="comment-header">
                    <div class="comment-author-info">
                        <img src="https://via.placeholder.com/48?text=小" alt="评论者头像" class="comment-avatar">
                        <div>
                            <div class="comment-author-name">小王同学</div>
                            <div class="comment-time">3天前</div>
                        </div>
                    </div>
                </div>
                <div class="comment-content">
                    非常感谢学长的分享！我想请问一下，专业课的复习资料有什么推荐吗？尤其是数据结构这门课，感觉学起来有点困难。
                </div>
                <div class="comment-actions">
                    <button class="comment-action-btn like-btn">
                        <i class="fa fa-thumbs-up"></i>
                        <span>点赞</span>
                        <span>(12)</span>
                    </button>
                    <button class="comment-action-btn reply-btn">
                        <i class="fa fa-reply"></i>
                        <span>回复</span>
                    </button>
                </div>
                
                <!-- 回复表单 (默认隐藏) -->
                <div class="reply-form" style="display: none;">
                    <div class="reply-input-container">
                        <textarea class="reply-textarea" placeholder="回复 小王同学..."></textarea>
                    </div>
                    <div class="reply-actions">
                        <button class="btn btn-secondary btn-sm cancel-reply-btn">取消</button>
                        <button class="btn btn-primary btn-sm submit-reply-btn">回复</button>
                    </div>
                </div>
                
                <!-- 回复列表 -->
                <ul class="replies-list">
                    <!-- 回复项1 -->
                    <li class="reply-item">
                        <img src="https://via.placeholder.com/32?text=学" alt="回复者头像" class="reply-avatar">
                        <div class="reply-content-wrapper">
                            <div class="reply-header">
                                <div class="reply-author-name">学长2023</div>
                                <div class="reply-time">2天前</div>
                            </div>
                            <div class="reply-content">
                                @小王同学 数据结构的话，我推荐《算法导论》和《编程之美》这两本书，另外可以多在LeetCode上刷题，提高编程能力。
                            </div>
                            <div class="reply-actions">
                                <button class="reply-action-btn like-btn">
                                    <i class="fa fa-thumbs-up"></i>
                                    <span>点赞</span>
                                    <span>(8)</span>
                                </button>
                                <button class="reply-action-btn reply-btn">
                                    <i class="fa fa-reply"></i>
                                    <span>回复</span>
                                </button>
                            </div>
                        </div>
                    </li>
                    
                    <!-- 回复项2 -->
                    <li class="reply-item">
                        <img src="https://via.placeholder.com/32?text=小" alt="回复者头像" class="reply-avatar">
                        <div class="reply-content-wrapper">
                            <div class="reply-header">
                                <div class="reply-author-name">小王同学</div>
                                <div class="reply-time">1天前</div>
                            </div>
                            <div class="reply-content">
                                @学长2023 好的，谢谢学长的建议！我会去看看这些书的。
                            </div>
                            <div class="reply-actions">
                                <button class="reply-action-btn like-btn">
                                    <i class="fa fa-thumbs-up"></i>
                                    <span>点赞</span>
                                    <span>(3)</span>
                                </button>
                                <button class="reply-action-btn reply-btn">
                                    <i class="fa fa-reply"></i>
                                    <span>回复</span>
                                </button>
                            </div>
                        </div>
                    </li>
                </ul>
            </li>
            
            <!-- 评论项2 -->
            <li class="comment-item">
                <div class="comment-header">
                    <div class="comment-author-info">
                        <img src="https://via.placeholder.com/48?text=李" alt="评论者头像" class="comment-avatar">
                        <div>
                            <div class="comment-author-name">小李同学</div>
                            <div class="comment-time">4天前</div>
                        </div>
                    </div>
                </div>
                <div class="comment-content">
                    学长的经验分享很详细，受益匪浅！我想请问一下，考研期间如何平衡专业课和公共课的复习时间呢？感觉时间不够用。
                </div>
                <div class="comment-actions">
                    <button class="comment-action-btn like-btn">
                        <i class="fa fa-thumbs-up"></i>
                        <span>点赞</span>
                        <span>(9)</span>
                    </button>
                    <button class="comment-action-btn reply-btn">
                        <i class="fa fa-reply"></i>
                        <span>回复</span>
                    </button>
                </div>
                
                <!-- 回复表单 (默认隐藏) -->
                <div class="reply-form" style="display: none;">
                    <div class="reply-input-container">
                        <textarea class="reply-textarea" placeholder="回复 小李同学..."></textarea>
                    </div>
                    <div class="reply-actions">
                        <button class="btn btn-secondary btn-sm cancel-reply-btn">取消</button>
                        <button class="btn btn-primary btn-sm submit-reply-btn">回复</button>
                    </div>
                </div>
                
                <!-- 回复列表 -->
                <ul class="replies-list">
                    <!-- 回复项1 -->
                    <li class="reply-item">
                        <img src="https://via.placeholder.com/32?text=学" alt="回复者头像" class="reply-avatar">
                        <div class="reply-content-wrapper">
                            <div class="reply-header">
                                <div class="reply-author-name">学长2023</div>
                                <div class="reply-time">3天前</div>
                            </div>
                            <div class="reply-content">
                                @小李同学 关于时间分配，我建议前期（3-6月）以英语和数学为主，专业课为辅；中期（7-10月）各科均衡复习；后期（11-12月）重点突破政治和专业课。另外，每天制定详细的复习计划，严格执行。
                            </div>
                            <div class="reply-actions">
                                <button class="reply-action-btn like-btn">
                                    <i class="fa fa-thumbs-up"></i>
                                    <span>点赞</span>
                                    <span>(6)</span>
                                </button>
                                <button class="reply-action-btn reply-btn">
                                    <i class="fa fa-reply"></i>
                                    <span>回复</span>
                                </button>
                            </div>
                        </div>
                    </li>
                </ul>
            </li>
            
            <!-- 评论项3 -->
            <li class="comment-item">
                <div class="comment-header">
                    <div class="comment-author-info">
                        <img src="https://via.placeholder.com/48?text=张" alt="评论者头像" class="comment-avatar">
                        <div>
                            <div class="comment-author-name">小张同学</div>
                            <div class="comment-time">5天前</div>
                        </div>
                    </div>
                </div>
                <div class="comment-content">
                    学长，我想问一下，复试的时候导师更看重什么呢？是专业知识、项目经验还是英语能力？
                </div>
                <div class="comment-actions">
                    <button class="comment-action-btn like-btn">
                        <i class="fa fa-thumbs-up"></i>
                        <span>点赞</span>
                        <span>(7)</span>
                    </button>
                    <button class="comment-action-btn reply-btn">
                        <i class="fa fa-reply"></i>
                        <span>回复</span>
                    </button>
                </div>
                
                <!-- 回复表单 (默认隐藏) -->
                <div class="reply-form" style="display: none;">
                    <div class="reply-input-container">
                        <textarea class="reply-textarea" placeholder="回复 小张同学..."></textarea>
                    </div>
                    <div class="reply-actions">
                        <button class="btn btn-secondary btn-sm cancel-reply-btn">取消</button>
                        <button class="btn btn-primary btn-sm submit-reply-btn">回复</button>
                    </div>
                </div>
            </li>
        </ul>
        
        <!-- 更多评论按钮 -->
        <div style="text-align: center; margin-top: 2rem;">
            <button id="load-more-comments-btn" class="btn btn-outline-secondary">
                <i class="fa fa-refresh mr-2"></i>
                加载更多评论
            </button>
        </div>
    </div>
    
    <!-- 相关话题 -->
    <div class="related-topics">
        <div class="related-topics-header">
            <h3 class="related-topics-title">
                <i class="fa fa-link mr-2"></i>
                相关话题
            </h3>
        </div>
        
        <ul class="related-topics-list">
            <li class="related-topic-item" data-topic-id="7">
                <a href="{{ url_for('forum_topic_detail', topic_id=7) }}" class="related-topic-title">计算机专业考研院校推荐及选择策略</a>
                <div class="related-topic-meta">
                    <div class="related-topic-author">
                        <i class="fa fa-user"></i>
                        考研指导老师
                    </div>
                    <div class="related-topic-time">
                        <i class="fa fa-clock-o"></i>
                        2周前
                    </div>
                    <div class="related-topic-stats">
                        <i class="fa fa-comment"></i>
                        25 回复
                    </div>
                </div>
            </li>
            <li class="related-topic-item" data-topic-id="8">
                <a href="{{ url_for('forum_topic_detail', topic_id=8) }}" class="related-topic-title">考研英语词汇记忆方法分享</a>
                <div class="related-topic-meta">
                    <div class="related-topic-author">
                        <i class="fa fa-user"></i>
                        英语学霸
                    </div>
                    <div class="related-topic-time">
                        <i class="fa fa-clock-o"></i>
                        3周前
                    </div>
                    <div class="related-topic-stats">
                        <i class="fa fa-comment"></i>
                        18 回复
                    </div>
                </div>
            </li>
            <li class="related-topic-item" data-topic-id="9">
                <a href="{{ url_for('forum_topic_detail', topic_id=9) }}" class="related-topic-title">计算机专业就业vs考研如何选择？</a>
                <div class="related-topic-meta">
                    <div class="related-topic-author">
                        <i class="fa fa-user"></i>
                        职业规划师
                    </div>
                    <div class="related-topic-time">
                        <i class="fa fa-clock-o"></i>
                        1个月前
                    </div>
                    <div class="related-topic-stats">
                        <i class="fa fa-comment"></i>
                        42 回复
                    </div>
                </div>
            </li>
        </ul>
    </div>
</div>
{% endblock %}

{% block js %}
<script>
    // 获取DOM元素
    const likeBtn = document.getElementById('like-btn');
    const bookmarkBtn = document.getElementById('bookmark-btn');
    const shareBtn = document.getElementById('share-btn');
    const reportBtn = document.getElementById('report-btn');
    const commentTextarea = document.getElementById('comment-textarea');
    const submitCommentBtn = document.getElementById('submit-comment-btn');
    const cancelCommentBtn = document.getElementById('cancel-comment-btn');
    const loadMoreCommentsBtn = document.getElementById('load-more-comments-btn');
    const replyBtns = document.querySelectorAll('.reply-btn');
    const likeCommentBtns = document.querySelectorAll('.comment-action-btn.like-btn');
    const likeReplyBtns = document.querySelectorAll('.reply-action-btn.like-btn');
    const submitReplyBtns = document.querySelectorAll('.submit-reply-btn');
    const cancelReplyBtns = document.querySelectorAll('.cancel-reply-btn');
    const relatedTopicItems = document.querySelectorAll('.related-topic-item');
    
    // 点赞按钮点击事件
    likeBtn.addEventListener('click', function() {
        const likeCountElement = this.querySelector('span:last-child');
        const likeCount = parseInt(likeCountElement.textContent.replace(/[()]/g, ''));
        
        if (this.classList.contains('liked')) {
            // 取消点赞
            this.classList.remove('liked');
            likeCountElement.textContent = `(${likeCount - 1})`;
        } else {
            // 点赞
            this.classList.add('liked');
            likeCountElement.textContent = `(${likeCount + 1})`;
        }
    });
    
    // 收藏按钮点击事件
    bookmarkBtn.addEventListener('click', function() {
        if (this.classList.contains('bookmarked')) {
            // 取消收藏
            this.classList.remove('bookmarked');
            this.querySelector('span').textContent = '收藏';
        } else {
            // 收藏
            this.classList.add('bookmarked');
            this.querySelector('span').textContent = '已收藏';
        }
    });
    
    // 分享按钮点击事件
    shareBtn.addEventListener('click', function() {
        alert('分享功能将在后续版本中实现');
    });
    
    // 举报按钮点击事件
    reportBtn.addEventListener('click', function() {
        alert('举报功能将在后续版本中实现');
    });
    
    // 提交评论按钮点击事件
    submitCommentBtn.addEventListener('click', function() {
        const commentContent = commentTextarea.value.trim();
        if (commentContent) {
            // 在实际应用中，这里应该提交评论到服务器
            alert(`评论已提交: ${commentContent}`);
            commentTextarea.value = '';
        } else {
            alert('请输入评论内容');
        }
    });
    
    // 取消评论按钮点击事件
    cancelCommentBtn.addEventListener('click', function() {
        commentTextarea.value = '';
    });
    
    // 加载更多评论按钮点击事件
    loadMoreCommentsBtn.addEventListener('click', function() {
        // 显示加载状态
        const originalText = this.innerHTML;
        this.innerHTML = '<i class="fa fa-spinner fa-spin mr-2"></i>加载中...';
        this.disabled = true;
        
        // 模拟加载延迟
        setTimeout(() => {
            this.innerHTML = originalText;
            this.disabled = false;
            alert('已加载全部评论');
        }, 1500);
    });
    
    // 评论区回复按钮点击事件
    replyBtns.forEach(btn => {
        btn.addEventListener('click', function() {
            // 获取当前评论项
            const commentItem = this.closest('.comment-item, .reply-item');
            // 获取回复表单
            const replyForm = commentItem.querySelector('.reply-form');
            
            // 如果回复表单已显示，则隐藏；否则显示
            if (replyForm && replyForm.style.display !== 'none') {
                replyForm.style.display = 'none';
            } else {
                // 隐藏所有其他回复表单
                document.querySelectorAll('.reply-form').forEach(form => {
                    form.style.display = 'none';
                });
                // 显示当前回复表单
                if (replyForm) {
                    replyForm.style.display = 'block';
                    // 自动聚焦到回复输入框
                    const replyTextarea = replyForm.querySelector('.reply-textarea');
                    if (replyTextarea) {
                        replyTextarea.focus();
                    }
                }
            }
        });
    });
    
    // 评论区点赞按钮点击事件
    likeCommentBtns.forEach(btn => {
        btn.addEventListener('click', function() {
            const likeCountElement = this.querySelector('span:last-child');
            const likeCount = parseInt(likeCountElement.textContent.replace(/[()]/g, ''));
            
            if (this.classList.contains('liked')) {
                // 取消点赞
                this.classList.remove('liked');
                likeCountElement.textContent = `(${likeCount - 1})`;
            } else {
                // 点赞
                this.classList.add('liked');
                likeCountElement.textContent = `(${likeCount + 1})`;
            }
        });
    });
    
    // 回复区点赞按钮点击事件
    likeReplyBtns.forEach(btn => {
        btn.addEventListener('click', function() {
            const likeCountElement = this.querySelector('span:last-child');
            const likeCount = parseInt(likeCountElement.textContent.replace(/[()]/g, ''));
            
            if (this.classList.contains('liked')) {
                // 取消点赞
                this.classList.remove('liked');
                likeCountElement.textContent = `(${likeCount - 1})`;
            } else {
                // 点赞
                this.classList.add('liked');
                likeCountElement.textContent = `(${likeCount + 1})`;
            }
        });
    });
    
    // 提交回复按钮点击事件
    submitReplyBtns.forEach(btn => {
        btn.addEventListener('click', function() {
            const replyForm = this.closest('.reply-form');
            const replyTextarea = replyForm.querySelector('.reply-textarea');
            const replyContent = replyTextarea.value.trim();
            
            if (replyContent) {
                // 在实际应用中，这里应该提交回复到服务器
                alert(`回复已提交: ${replyContent}`);
                replyTextarea.value = '';
                replyForm.style.display = 'none';
            } else {
                alert('请输入回复内容');
            }
        });
    });
    
    // 取消回复按钮点击事件
    cancelReplyBtns.forEach(btn => {
        btn.addEventListener('click', function() {
            const replyForm = this.closest('.reply-form');
            replyForm.querySelector('.reply-textarea').value = '';
            replyForm.style.display = 'none';
        });
    });
    
    // 相关话题项点击事件
    relatedTopicItems.forEach(item => {
        item.addEventListener('click', function() {
            const topicId = this.getAttribute('data-topic-id');
            // 在实际应用中，这里应该跳转到相关话题详情页
            window.location.href = `{{ url_for('forum_topic_detail', topic_id=0) }}`.replace('0', topicId);
        });
        
        // 为话题标题添加独立的点击事件，防止冒泡
        const topicTitle = item.querySelector('.related-topic-title');
        if (topicTitle) {
            topicTitle.addEventListener('click', function(e) {
                e.stopPropagation();
            });
        }
    });
    
    // 页面载入动画
    document.addEventListener('DOMContentLoaded', function() {
        const containers = [
            '.topic-header',
            '.topic-content',
            '.topic-actions',
            '.comment-section',
            '.related-topics'
        ];
        
        containers.forEach((selector, index) => {
            const element = document.querySelector(selector);
            if (element) {
                element.style.opacity = '0';
                element.style.transform = 'translateY(20px)';
                element.style.transition = `opacity 0.5s ease ${index * 200}ms, transform 0.5s ease ${index * 200}ms`;
                
                setTimeout(() => {
                    element.style.opacity = '1';
                    element.style.transform = 'translateY(0)';
                }, 100 + index * 200);
            }
        });
        
        // 为评论项添加渐进式动画
        const commentItems = document.querySelectorAll('.comment-item');
        commentItems.forEach((item, index) => {
            item.style.opacity = '0';
            item.style.transform = 'translateY(10px)';
            item.style.transition = `opacity 0.3s ease ${1000 + index * 100}ms, transform 0.3s ease ${1000 + index * 100}ms`;
            
            setTimeout(() => {
                item.style.opacity = '1';
                item.style.transform = 'translateY(0)';
            }, 1000 + index * 100);
        });
        
        // 为相关话题项添加渐进式动画
        const relatedTopicElements = document.querySelectorAll('.related-topic-item');
        relatedTopicElements.forEach((item, index) => {
            item.style.opacity = '0';
            item.style.transform = 'translateY(10px)';
            item.style.transition = `opacity 0.3s ease ${1500 + index * 100}ms, transform 0.3s ease ${1500 + index * 100}ms`;
            
            setTimeout(() => {
                item.style.opacity = '1';
                item.style.transform = 'translateY(0)';
            }, 1500 + index * 100);
        });
    });
</script>
{% endblock %}